<?php

namespace app\common\model;

use app\company\model\CompanyOrder;
use app\company\model\CompanyUser;
use think\model\relation\BelongsTo;
use think\model\relation\HasMany;

class Company extends BaseModel
{
    /**
     * @return BelongsTo
     */
    public function group(): BelongsTo
    {
        return $this->belongsTo(Group::class, 'group_id', 'id');
    }

    /**
     * @return HasMany
     */
    public function user(): HasMany
    {
        return $this->hasMany(CompanyUser::class, 'company_id', 'id');
    }

    public function orders(): HasMany
    {
        return $this->hasMany(CompanyOrder::class, 'company_id', 'id');
    }
}